using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class vBillTotalTypeMap : EntityTypeConfiguration<vBillTotalType>
    {
        public vBillTotalTypeMap()
        {
            // Primary Key
            this.HasKey(t => new { t.Type, t.Number });

            // Properties
            this.Property(t => t.Type)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.Number)
                .IsRequired()
                .HasMaxLength(8);

            // Table & Column Mappings
            this.ToTable("vBillTotalType");
            this.Property(t => t.Type).HasColumnName("Type");
            this.Property(t => t.Number).HasColumnName("Number");
            this.Property(t => t.TotalType).HasColumnName("TotalType");
            this.Property(t => t.Guarantor1_Total_Type).HasColumnName("Guarantor1_Total_Type");
            this.Property(t => t.Guarantor2_Total_Type).HasColumnName("Guarantor2_Total_Type");
        }
    }
}
